﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AgileZen.Models;

namespace AgileZen.Sample.Controllers
{
    public class UserController : AgileZenController
    {
        //
        // GET: /User/

        public ActionResult Index()
        {
            return View(AgileZenService.GetMe(Person.Enrichments.Stories));
        }


        public ActionResult Edit(int id)
        {

            try
            {
                var me = AgileZenService.GetMe();
                return View(me);
            }
            catch
            {
                return View();
            }

        }

        //
        // POST: /Project/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, Person me)
        {
            try
            {
                // TODO: Add update logic here
                AgileZenService.UpdateMe(ref me);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        public ActionResult Stories() 
        {
            var stories = AgileZenService.GetMyStories();

            return View(stories);
        }
    }
}
